
<template>
  <!-- 组件结构 -->
  <div class="demo">
    <h2>学校名称：{{ schoolName }}</h2>
    <h2>学校地址：{{ address }}</h2>
    <button @click="showName">点我提示学校名</button>
  </div>
</template>

<script>
// 组件交互代码

export default {
  name: "SchoolSchool",
  data() {
    return {
      schoolName: "CQBZ",
      address: "CQ",
    };
  },
  methods: {
    showName() {
      console.log("showName", this);
      alert(this.schoolName);
      console.log(this.x); //从原型获得
    },
  },
};
</script>

<style>
/* 样式 */
.demo {
  background-color: aliceblue;
}
</style>